<div class="row">
  <div class="col-md-12">
    <h1>
      <%= link_to image_tag(@repository.avatar_url(100), width: 50, height: 50, alt: @repository), user_path(@repository.owner.to_param) %>
      <%= link_to @repository.full_name, repository_path(@repository.to_param) %> -
      Web Hooks
    </h1>
  </div>
</div>
<div class="row">
  <div class="col-md-8">
    <% if @web_hooks.any? %>
      <table class='table' id='web_hooks'>
        <tr>
          <th>
            URL
          </th>
          <th>
            Last Sent
          </th>
          <th>
            Last Response
          </th>
          <th>

          </th>
        </tr>
        <%= render @web_hooks %>
      </table>
      <%= will_paginate @repos, page_links: false %>
    <% else %>
      <p>
        No web hooks added to this repositories yet.
      </p>
    <% end %>
  </div>
  <div class="col-md-4">
    <h4>How's this work?</h4>
    <p>
      Libraries.io will post JSON to your web hook url whenever a new version of a package that your repository depends on is released.
    </p>
    <p class='text-center'>
      <%= link_to 'Add a web hook', new_repository_web_hook_path(@repository.to_param), class: 'btn btn-primary' %>
    </p>
    <hr>
    <p>
      Example payload data:
    </p>
    <pre>
{
   "event":"new_version",
   "repository":"foo/bar",
   "platform":"NPM",
   "name":"faye",
   "version":"0.5.0",
   "package_manager_url":"https://www.npmjs.com/package/faye",
   "published_at":"2010-12-19T15:04:47.790Z",
   "project":{
      "name":"faye",
      "platform":"NPM",
      "description":"Simple pub/sub messaging for the web",
      "homepage":"http://faye.jcoglan.com",
      "repository_url":"https://github.com/faye/faye",
      "normalized_licenses":[
         "MIT"
      ],
      "latest_release_published_at":"2015-02-25T00:17:29.493Z",
      "language":"JavaScript"
   }
}
    </pre>
  </div>
</div>
